package com.yaolong.api.modules.gen.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.yaolong.api.modules.gen.model.entity.DataSource;
import com.yaolong.api.modules.gen.service.ITableService;
import com.yaolong.api.modules.gen.utils.MybatisPlusCodeGenUtil;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yaolong
 * @version V1.0.0
 * @program AgileFastFK3.0
 * @description 表结构实现类
 * @create 2023-01-03 16:26
 **/
@Service
public class TableServiceImpl implements ITableService {


    @Override
    public List<TableInfo> list(DataSource dataSource, String prefix) {
        if (ObjectUtil.isEmpty(prefix)) {
            prefix = "";
        }
        List<TableInfo> tableInfoList = MybatisPlusCodeGenUtil.getTableInfoList(dataSource, prefix.split("::"));
        return tableInfoList;
    }

}
